import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect: 'index',
    children: [
      {
        path: 'index',
        component: ()=>import('../views/home/IndexView.vue')
      },
      {
        path: 'reg',
        component: ()=>import('../views/home/RegView.vue')
      },
      {
        path: 'login',
        component: ()=>import('../views/home/LoginView.vue')
      },
      {
        path: 'changzu',
        component: ()=>import('../views/home/ChangZuView.vue')
      },
      {
        path: 'order',
        component: ()=>import('../views/home/OrderView.vue')
      },
      {
          path: '/personal',
          component: ()=>import('../views/home/PersonalView.vue'),
          redirect: '/personal/info',
          children: [
            {
              path: 'info',
              component: ()=>import('../views/personal/InfoView.vue')
            },
            {
              path: 'audit',
              component: ()=>import('../views/personal/AuditView.vue')
            },
          ]
      },
      {
        path: 'duanzu',
        component: ()=>import('../views/home/DuanZuView.vue')
      },
      {
        path: 'detail',
        component: ()=>import('../views/home/DetailView.vue')
      },
    ]
  },
  {
    path: '/admin',
    component: ()=>import('../views/AdminView.vue'),
    redirect: '/admin/index',
    children: [
        {
          path: 'index',
          component: ()=>import('../views/admin/AdminIndexView.vue'),
        },
      {
        path: 'audit',
        component: ()=>import('../views/admin/AdminAuditView.vue'),
      },
      {
        path: 'auditDetail',
        component: ()=>import('../views/admin/AdminAuditDetailView.vue'),
      },
      {
        path: 'car',
        component: ()=>import('../views/admin/AdminCarView'),
      },
      {
        path: 'city',
        component: ()=>import('../views/admin/AdminCityView.vue'),
      },
      {
        path: 'order',
        component: ()=>import('../views/admin/AdminOrderView.vue'),
      },
      {
        path: 'brand',
        component: ()=>import('../views/admin/AdminBrandView.vue'),
      },
      {
        path: 'carpost',
        component: ()=>import('../views/admin/CarPostView.vue'),
      },
      {
        path: 'citypost',
        component: ()=>import('../views/admin/CityPostView.vue'),
      },
      {
        path: 'brandpost',
        component: ()=>import('../views/admin/BrandPostView.vue'),
      },
    ]
  },
  {
    path: '/pay',
    component: ()=>import('../views/PayView.vue'),
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
